package com.lzt.flow.controller;

import com.lzt.flow.common.CommonResult;
import com.lzt.flow.entity.FlowForm;
import com.lzt.flow.service.FlowService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

@Slf4j
@RestController
public class FlowController {

    @Resource
    private FlowService flowService;

    @PostMapping("/executeFlow")
    public CommonResult<Map<String, Object>> executeFlow(@RequestBody FlowForm flowForm) throws Exception {
        log.info("执行流程 flowForm:{}", flowForm);
        Map<String, Object> data = flowService.executeFlow(flowForm);
        return CommonResult.success(data);
    }
}
